# -*- coding: utf-8 -*-
# @Time : 2022/3/18 10:03
# @Author : Liuqing
# @File : 283)移动零.py
# @Software : PyCharm


class Solution(object):
    def moveZeroes(self, nums):
        """
        :type nums: List[int]
        :rtype: None Do not return anything, modify nums in-place instead.
        """
        length = len(nums)
        zero = length
        if length == 1:
            return
        index = 0
        while True:
            if nums[index] == 0:
                nums.append(nums.pop(index))
                zero -= 1
            else:
                index += 1
            if index == zero:
                return



if __name__ == '__main__':
    print(Solution().moveZeroes([0, 1, 0, 3, 12]))
    print(Solution().moveZeroes([0]))
